﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using Com.Library.DB.Store;

namespace Com.Web.coffinegurunaru.AppLogic
{
	public static class StoreExtenstion
	{
		public static string GetCompanyNo(this StoreEntity info, int idx)
		{
			string[] CompanyNo = info.CompanyNo.Split('-');

			if (CompanyNo.Length != 3)
				return string.Empty;

			return CompanyNo[idx];
		}

		public static string GetPhone(this StoreEntity info, int idx)
		{
			string[] Phone = info.Phone.Split('-');

			if (Phone.Length != 3)
				return string.Empty;

			return Phone[idx];
		}

		public static string GetPostNo(this StoreEntity info, int idx)
		{
			string[] Post = info.Post.Split('-');

			if (Post.Length != 2)
				return string.Empty;

			return Post[idx];
		}

		public static string GetImageURL(this StoreBestEntity info)
		{
			List<StoreImageEntity> list = StoreModel.ImageGetList(info.StoreNo, 1);
			if (list.Count == 0)
				return "/images/store/store_s.jpg";
			return list[0].ImageURL;
		}

		public static string GetImageURL(this StoreEntity info)
		{
			List<StoreImageEntity> list = StoreModel.ImageGetList(info.StoreNo, 1);
			if (list.Count == 0)
				return "/images/store/store_s.jpg";
			return list[0].ImageURL;
		}
	}
}
